<template>
  <div style="width: 400px; margin: 50px auto">
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-form-item label="激活码" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>
    </el-form>
    <p style="text-align: center" slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm('ruleForm')"
        >确 定</el-button
      >
    </p>
  </div>
</template>

<script>
import { zengji, getji, xiuji, jihuoji } from "@/api/system/user";

export default {
  data() {
    return {
      ruleForm: {
        name: "",
      },
      rules: {
        name: [{ required: true, message: "请输入激活码", trigger: "blur" }],
      },
    };
  },

  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          jihuoji(this.ruleForm).then((res) => {
            if (res.code == 200) {
              this.$modal.msgSuccess(res.msg);
              this.dialogVisible = false;
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
};
</script>

<style></style>
